﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;

using DQYT.HTDZ.BLL;
using DQYT.HTDZ.Model;

namespace DQYT.HTDZ.Web.BDGQ
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(this.txtGQID.Text.Trim().Length==0)
			{
				strErr+="GQID不能为空！\\n";	
			}
			if(this.txtGQMC.Text.Trim().Length==0)
			{
				strErr+="GQMC不能为空！\\n";	
			}
			if(this.txtGQLX.Text.Trim().Length==0)
			{
				strErr+="GQLX不能为空！\\n";	
			}
			if(this.txtSSDCBH.Text.Trim().Length==0)
			{
				strErr+="SSDCBH不能为空！\\n";	
			}
			if(this.txtQK.Text.Trim().Length==0)
			{
				strErr+="QK不能为空！\\n";	
			}
			if(!PageValidate.IsDecimal(txtSFYTZX.Text))
			{
				strErr+="SFYTZX格式错误！\\n";	
			}
			if(!PageValidate.IsDecimal(txtZXWD.Text))
			{
				strErr+="ZXWD格式错误！\\n";	
			}
			if(!PageValidate.IsDecimal(txtZXJD.Text))
			{
				strErr+="ZXJD格式错误！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			string GQID=this.txtGQID.Text;
			string GQMC=this.txtGQMC.Text;
			string GQLX=this.txtGQLX.Text;
			string SSDCBH=this.txtSSDCBH.Text;
			string QK=this.txtQK.Text;
			decimal SFYTZX=decimal.Parse(this.txtSFYTZX.Text);
			decimal ZXWD=decimal.Parse(this.txtZXWD.Text);
			decimal ZXJD=decimal.Parse(this.txtZXJD.Text);

			BDGQModel model=new BDGQModel();
			model.GQID=GQID;
			model.GQMC=GQMC;
			model.GQLX=GQLX;
			model.SSDCBH=SSDCBH;
			model.QK=QK;
			model.SFYTZX=SFYTZX;
			model.ZXWD=ZXWD;
			model.ZXJD=ZXJD;

			BDGQBLL bll=new BDGQBLL();
			bll.Add(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
